import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    count: 2105,
    city: "火星",
    word: "Are you Ok?",
    flag: "true",
    text: "Vue太难了",
    msg: "你最近累吗?",
  },
  actions: {
  },
  mutations: {
    countAdd(state) {
      state.count++;
    },
    countReduce(state) {
      state.count--;
    },
    changeCount(state, payload) { /* payload 载荷 参数 */
      state.count += payload;
    },
    changeCity(state, payload) {
      state.city = payload;
    },
    changeWord(state, payload) {
      state.word = payload;
    },
    changeFlag(state) {
      state.flag = !state.flag;
    },
    changeText(state, payload) {
      state.text = payload;
    },
    changeMsg(state, payload) {
      state.msg = payload;
    }
  },
  getters: {
  }
})
export default store